/*
 * @Author: your name
 * @Date: 2020-10-31 17:24:08
 * @LastEditTime: 2020-12-06 17:10:41
 * @LastEditors: Please set LastEditors
 * @Description: In User Settings Edit
 * @FilePath: \sportapp\server\connect.js
 */
const { ObjectId } = require("mongodb");
const { MongoClient } = require("mongodb");
const { resolve } = require("mongodb/lib/core/topologies/read_preference");

// Replace the uri string with your MongoDB deployment's connection string.
const uri =
  "mongodb:输入地址";
const client = new MongoClient(uri);
let database=null

async function run() {
    try {
      await client.connect();
      database= await client.db('sports');
      return {database,client}
    } catch(error){
      console.log(error)
    }
  
    finally {
      
    }
  }



// run().then(res=>{

//     console.log("66664")
//     // console.log(res);
//     // getGameList(res)
//     database=res


// })

module.exports = run



